home *** CD-ROM | disk | FTP | other *** search
- /****************************************/
-
- /* AppleExtras.c */
- /* Author: Shemin Gau, IP */
- /* Revision History: 04/05/94 */
-
- /****************************************/
-
-
- #include <Files.h>
- #include <string.h>
- #include <Memory.h>
- #include <ToolUtils.h>
- #include <Errors.h>
- #include <Packages.h>
- #include <Types.h>
- #include <OSUtils.h>
-
-
- OSErr SetContextResult(void* theData, Size theSize, Ptr* outMessage, Size* outSize);
-
-
- pascal OSErr main(Str255 msg, Size inSize, void* outMessage, Size* outSize, Handle ignoreMe)
- {
-
- FInfo fi;
- char *cDummy;
- Str255 volName;
- short vRefNum;
- long freeBytes;
- char *ctemp;
- StringPtr ptemp;
-
- Boolean result = false;
- OSErr myErr = noErr;
-
-
- // volName should be a pascal string pointer
- if (GetVInfo(0, volName, &vRefNum, &freeBytes) == noErr) {
- // be sure to use Str255 for c2pstr()
- cDummy = p2cstr(volName);
- }
- else {
- SetContextResult(&result, sizeof(Boolean), outMessage, outSize);
- return(1);
- }
-
-
- ctemp = p2cstr(msg);
- strcat(cDummy, ctemp);
- //now, convert the whole pathname into pascal string
- ptemp = c2pstr(cDummy);
-
- if (GetFInfo(ptemp, 0, &fi) == noErr) {
- result = true;
- }
-
- myErr = SetContextResult(&result, sizeof(Boolean), outMessage, outSize);
- return(myErr);
- }
-
-
- OSErr SetContextResult(void* theData, Size theSize, Ptr* outMessage, Size* outSize)
- {
- Ptr p;
-
- if (p = NewPtr(theSize)) {
- BlockMove(theData, p, theSize);
-
- *outSize = theSize;
- *outMessage = p;
-
- return(noErr);
- } else {
- return(MemError());
- }
- }
-
-
-